package ink.metoo.gude.module.security.service

interface VerificationCodeService {

    fun getVerificationCode(key: String, type: String): String?

    fun restVerificationCode(key: String, type: String): String

    fun clearVerificationCode(key: String, type: String)

    fun tryVerificationCode(key: String, type: String, block: (code: String?) -> Unit) {
        val verificationCode = getVerificationCode(key, type)
        block(verificationCode)
        clearVerificationCode(key, type)
    }

}